package com.zy.cat.entity.dev;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Index;
import javax.persistence.Table;

import org.apache.commons.lang3.RandomUtils;

import com.zy.cat.common.utils.TJKUtils;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.RequiredArgsConstructor;

/**
 * @info 9趣猫提现详细信息实体类
 * @author Link
 * @date 2019-07-04 08:58
 */
@Entity
@Table(name = "zy_cat_remit_list", indexes = {
		@Index(name = "pid", columnList = "pid"),
		@Index(name = "oid", columnList = "oid"),
		@Index(name = "tstatus", columnList = "tstatus"),
		@Index(name = "dstatus", columnList = "dstatus"),
		@Index(name = "qtype", columnList = "qtype"),
		@Index(name = "ttime", columnList = "ttime"),
		@Index(name = "ltime", columnList = "ltime"),
		@Index(name = "ctime", columnList = "ctime") })
@Data
@RequiredArgsConstructor
@ApiModel("9趣猫提现详细信息实体类")
public class CatDevRemitInfo {

	@Id
	@Column(columnDefinition = "VARCHAR(32) NOT NULL COMMENT '取款订单号[9趣猫微信提现记录]'")
	@ApiModelProperty(value = "订单号", example = "WX8510241024543843")
	private String oid;
	
	@Column(columnDefinition = "VARCHAR(32) NOT NULL COMMENT '用户ID'")
	@ApiModelProperty(value = "用户ID", example = "8510241024543843")
	private String pid;
	
	@Column(columnDefinition = "VARCHAR(10) DEFAULT '-'  COMMENT '提现时间'")
	@ApiModelProperty(value = "提现时间", example = "2019-02-22")
	private String ttime;
	
	@Column(columnDefinition = "INT(1) DEFAULT '0' COMMENT '到账类型（0.立即到账、1.审核到账）'")
	@ApiModelProperty(value = "到账类型（0.立即到账、1.审核到账）", example = "0")
	private int dtype;
	
	@Column(columnDefinition = "VARCHAR(20) DEFAULT '-'  COMMENT '付款时间'")
	@ApiModelProperty(value = "付款时间", example = "2019-02-22 12:56:56")
	private String ptime;
	
	@Column(columnDefinition = "INT(1) DEFAULT '0' COMMENT '打款类型0.微信、1.支付宝'")
	@ApiModelProperty(value = "打款类型0.微信、1.支付宝", example = "0")
	private int qtype;
	
	@Column(columnDefinition = "INT(1) DEFAULT '0' COMMENT '取款类型（0.正常提现、1.正常邀请提现、2.互拆邀请提现、3.新用户体验提现、4.订单返利提现、5.5088奖励提现）'")
	@ApiModelProperty(value = "取款类型（0.正常提款、1.正常邀请提现、2.互拆邀请提现、3.新用户体验提现、4.订单返利提现、5.5088奖励提现）", example = "0")
	private int rtype;
	
	@Column(columnDefinition = "VARCHAR(100) DEFAULT '-' COMMENT '微信unionid取款标识'")
	@ApiModelProperty(value = "微信unionid取款标识", example = "4543843")
	private String unionid;
	
	@Column(columnDefinition = "VARCHAR(100) DEFAULT '-' COMMENT '微信openid取款标识'")
	@ApiModelProperty(value = "微信openid取款标识", example = "4543843")
	private String openid;
	
	@Column(columnDefinition = "VARCHAR(32) DEFAULT '-' COMMENT '支付宝提款账户'")
	@ApiModelProperty(value = "支付宝提款账户", example = "13854197520")
	private String zaccount;
	
	@Column(columnDefinition = "VARCHAR(32) DEFAULT '-' COMMENT '支付宝提款账户真是姓名'")
	@ApiModelProperty(value = "支付宝提款账户真实姓名", example = "张三")
	private String zrealname;
	
	@Column(columnDefinition = "BIGINT(20) DEFAULT '0' COMMENT '提现金额（分）'")
	@ApiModelProperty(value = "提现金额（分）", example = "100")
	private long dmoney;

	@Column(columnDefinition = "INT(2) DEFAULT '0' COMMENT '提现状态，（-1：提现失败、0：审核中 、1.提现中 、2.已到账）'")
	@ApiModelProperty(value = "提现状态，（-1：提现失败、0：审核中 、1.提现中 、2.已到账）", example = "0")
	private int tstatus;
	
	@Column(columnDefinition = "INT(2) DEFAULT '0' COMMENT '打款状态，（-1：打款失败、0：打款中 、1.打款成功）'")
	@ApiModelProperty(value = "打款状态，（-1：打款失败、0：打款中 、1.打款成功）", example = "0")
	private int dstatus;
	
	@Column(columnDefinition = "VARCHAR(20) DEFAULT '-'  COMMENT '创建时间'")
	@ApiModelProperty(value = "创建时间", example = "2019-02-22 12:56:56")
	private String ctime;
	
	@Column(columnDefinition = "VARCHAR(20) DEFAULT '-'  COMMENT '最后更新时间'")
	@ApiModelProperty(value = "最后更新时间", example = "2019-02-22 12:56:56")
	private String ltime;

	@Column(columnDefinition = "VARCHAR(200) DEFAULT '-' COMMENT '用户提现备注'")
	@ApiModelProperty(value = "用户提现备注", example = "备注")
	private String tinfo = "-";
	
	@Column(columnDefinition = "VARCHAR(200) DEFAULT '-' COMMENT '系统打款备注'")
	@ApiModelProperty(value = "系统打款备注", example = "备注")
	private String dinfo = "-";

	public CatDevRemitInfo(String pid) {
		super();
		this.pid = pid;
	}

	public CatDevRemitInfo(String pid, int dstatus) {
		super();
		this.pid = pid;
		this.dstatus = dstatus;
	}

	public CatDevRemitInfo(String pid, String ttime, int qtype, String zaccount, String zrealname, long dmoney,
			String ctime, String tinfo) {
		super();
		this.oid = RandomUtils.nextLong(11111,99999)+""+RandomUtils.nextLong(22222,99999)+""+RandomUtils.nextLong(33333,99999);
		String time=TJKUtils.DateTime("yyMMdd");
		if(qtype==0) {
			this.oid="WX"+time+this.oid;
		}else {
			this.oid="ZFB"+time+this.oid;
		}
		this.pid = pid;
		this.ttime = ttime;
		this.qtype = qtype;
		this.zaccount = zaccount;
		this.zrealname = zrealname;
		this.dmoney = dmoney;
		this.ctime = ctime;
		this.tinfo = tinfo;
	}
	
}
